package xixirupan.tmgp.tencent.com.vmeim.ui.beautyshop.presenter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import java.util.List;
import java.util.Map;

import xixirupan.tmgp.tencent.com.vmeim.R;

/**
 * Created by lenovo on 2016/10/19.
 */

public class Item3RecyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    List<Map<String,String>> lists;
    LayoutInflater inflater;
    Context context;
   public Item3RecyAdapter(List<Map<String,String>> lists, LayoutInflater inflater, Context context)
   {
       this.inflater =inflater;
       this.lists =lists;
       this.context =context;
   }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item3_index_gridvew, parent, false);
        ViewHolder1 viewHolder1 =new ViewHolder1(view);

        return viewHolder1;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
      if (holder instanceof ViewHolder1)
      {
          Map<String, String> map = lists.get(position);
          String imgUrl = map.get("imgUrl");

          Glide.with(context).load(imgUrl).into(((ViewHolder1) holder).imageView);

      }
    }

    @Override
    public int getItemCount() {
        return lists.size();
    }
    class ViewHolder1 extends RecyclerView.ViewHolder {
        ImageView imageView;
        public ViewHolder1(View itemView) {
            super(itemView);
            imageView = (ImageView) itemView.findViewById(R.id.item3_inne_grideview);
        }
    }
}
